package com.terracloud.server.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.DependsOn;
import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.ReactorClientHttpRequestFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;

/**
 *
 * @author chenhainan
 * @since 2025/11/13
 */
@Component
public class BeanConfig {

    @Bean
    public ClientHttpRequestFactory clientHttpRequestFactory() {
        return new ReactorClientHttpRequestFactory();
    }

    @Bean
    @DependsOn("clientHttpRequestFactory")
    public RestTemplate restTemplate(ClientHttpRequestFactory clientHttpRequestFactory) {
        return new RestTemplate(clientHttpRequestFactory);
    }

}
